{include file="common/top" /}
<link  type="text/css" href="__static/ossupload/style.css"/>
<div style="padding: 20px;background: #ffffff;" >
	<form class="layui-form " action="">
	
	<div class="layui-form-item">
		<label class="layui-form-label">*消耗时间：</label>
		<div class="layui-col-xs4">
			<input type="text" name="time" id="test1" lay-verify="required" readonly="" autocomplete="off" placeholder="yyyy-mm-dd h:i:s" class="layui-input">
		</div>
		<label class="layui-form-label">*消耗：</label>
		<div class="layui-col-xs4">
			<input type="text" name="currency" lay-verify="required" autocomplete="off" placeholder="请输入消耗账户币" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">表单数量：</label>
		<div class="layui-col-xs4">
			<input type="text" name="num"   autocomplete="off" placeholder="0" class="layui-input">
			<div class="layui-form-mid layui-word-aux">没有可不填，默认0</div>
		</div>
		<label class="layui-form-label">运营类型：</label>
		<div class="layui-col-xs4">
			<select name="is_operate" autocomplete="off">
				<option value="1">自运营</option>
				<option value="2">代运营</option>
				<option value="3">纯代运营</option>
	        </select>
		</div>
		
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">*昨日余额：</label>
		<div class="layui-col-xs4">
			<input type="text" name="balance" lay-verify="required" autocomplete="off" placeholder="请输入昨日余额" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">凭证上传：</label>
		<div class="layui-col-xs8">
			<div id="container">
				<a id="selectfiles" href="javascript:void(0);" class='btn layui-btn'>选择文件</a>
				<a id="postfiles" href="javascript:void(0);" class='btn layui-btn'>开始上传</a>
			</div>
			<pre id="console"></pre>
			<p>&nbsp;</p>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label"></label>
		<div class="layui-col-xs10">
			<h4>您所选择的文件列表：</h4>
			<div id="ossfile">你的浏览器不支持flash,Silverlight或者HTML5！</div>
			<br/>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label"></label>
		<div class="layui-col-xs10" >
			<div id="img"></div>
		</div>
	</div>
	<hr />
	<div class="layui-form-item">
		<div class="layui-input-block">
			<input type="hidden" id='image'  name="proof_url" value="">
			<input type="hidden" name="op_account_id" value="{$data.op_account_id}">
			<input type="hidden" name="items_id" value="{$data.items_id}">
			<button class="layui-btn"  lay-submit="" lay-filter="demo1">添加</button>
		</div>
	</div>
	
	</form>
	
</div>
{include file="common/footer" /}
<script type="text/javascript" src="__static/ossupload/lib/crypto1/crypto/crypto.js"></script>
<script type="text/javascript" src="__static/ossupload/lib/crypto1/hmac/hmac.js"></script>
<script type="text/javascript" src="__static/ossupload/lib/crypto1/sha1/sha1.js"></script>
<script type="text/javascript" src="__static/ossupload/lib/base64.js"></script>
<script type="text/javascript" src="__static/ossupload/lib/plupload-2.1.2/js/plupload.full.min.js"></script>
<script type="text/javascript" src="__static/ossupload/upload.js"></script>
<script>
	//获取昨天时间戳
	var day1 = new Date();
	var d1 = day1.setTime(day1.getTime()-24*60*60*1000);
	layui.use(['form', 'layedit', 'laydate'], function(){
		  var form = layui.form ,layer = layui.layer,laydate= layui.laydate;
		  laydate.render({
			    elem: '#test1', //指定元素
			    type: 'datetime',
			    value: new Date(d1)
			  });
		  //监听提交
		  form.on('submit(demo1)', function(data){
			var articleFrom = data.field;
			layer.load(1, { shade : [ 0.5, '#676a6c' ] });
			$.post("{:url('Operate/consume_add')}?t=json",articleFrom,function(data){
				layer.closeAll();
				if (data['code'] == 1) {
					var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
					parent.layer.close(index1); //再执行关闭 
					//父页面数据 ，重新加载
					//parent.get_load(data['msg']);
					parent.get_consume_list(data['msg']);
				} else {
					layer.msg(data['msg'], { icon : 5 });
				}
			});
			
			return false;
		  });
		
		 
		});
	
	
</script>
